{extend name="$base" /}
{block name="resources"}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/member_list.css" />
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>

{/block}
{block name="main"}
<table class="mytable">
	<tr>
		<th width="20%" style="text-align: left;">

		</th>

		<th>

		</th>
	</tr>
</table>
<table class="table-class">
	<thead>
		<tr align="center">
			<th>
				<i class="checkbox-common"><input type="checkbox" onclick="CheckAll(this)"></i>
			</th>
			<th style="width: 25%;">会员</th>
			<th>认证</th>
			<th>推广人</th>
			<th align="left">认证信息</th>
			<th>注册&登录</th>
			<th>状态</th>
			<th style="width: 15%;">操作</th>
		</tr>
	</thead>
	<tbody id="productTbody"></tbody>
</table>

{/block}
{block name="script"}
<script type="text/javascript">
function LoadingInfo(page_index) {
	var search_text = $("#search_text").val();
	var levelid = $("#level_name").val();
    var verify_status = $("#verify_status").val();
    var user_status = $("#user_status").val();

	$.ajax({
		type : "post",
		url : document.location,
		data : {
			"page_index" : page_index, "page_size" : $("#showNumber").val(), "search_text" : search_text,"levelid":levelid,"verify_status":verify_status,
			"user_status":user_status
		},
		success : function(data) {
			// alert(JSON.stringify(data));
			var html = '';
			if (data["data"].length > 0) {
				for (var i = 0; i < data["data"].length; i++) {
					html += '<tr align="center">';
					html += '<td title="'+ [' + data["data"][i]["user_name"]  + '] +'"><i class="checkbox-common"><input name="sub" type="checkbox" value="'+ data["data"][i]["uid"]+'" ></i></td>';
					html += '<td align="left">';
                    html += '<a onclick=view_Member('+ data["data"][i]["uid"] +')>';
					if(data["data"][i]["user_headimg"] =="") {html += '<img src="{:__IMG($default_headimg)}" class="head-portrait" />';}
                    else {html += '<img src="'+__IMG(data["data"][i]["user_headimg"])+'" class="head-portrait" onerror="this.src=\'{:__IMG($default_headimg)}\'"/>';}
                    html += '</a>';
					html += '<div style="float:left;">';
					if(data["data"][i]["real_name"] == '' || data["data"][i]["real_name"] == null){data["data"][i]["real_name"] = '--'}
                    html += '<label style="float:none;width:100%">姓名：<span>' + data["data"][i]["real_name"] +  '</span></label>';
                    if(data["data"][i]["nick_name"] == '' || data["data"][i]["nick_name"] == null){data["data"][i]["nick_name"] = '--'}
                    if(data["data"][i]["user_tel"] == '' || data["data"][i]["user_name"] == null){data["data"][i]["user_tel"] = '--'}
                    html += '<label style="float:none;width:100%">手机：<span>' + data["data"][i]["user_tel"] + '</span></label>';
                    if(data["data"][i]["source"] == 0 || data["data"][i]["source"] == null){data["data"][i]["source"] = '--'}
                    if(data["data"][i]["level_name"]==null || data["data"][i]["level_name"]==undefined){data["data"][i]["level_name"] = '--';}
                    html += '<label style="float:none;width:100%">IP：<span>' + data["data"][i]["current_login_ip"] + '</span></label>';
					html += '<label style="float:none;width:100%">ID：<span>' + data["data"][i]["user_name"] + '</span></label>';

					html += '</div>';
					html += '</td>';

                    // 推广信息
                    html += '<td>';
                    html += '<div >';
                    if(data["data"][i]["verify_status"] == 2)
                    {
                        html += '<font color="green">已认证</font>';

                    }
                    else if(data["data"][i]["verify_status"] == 0)
                    {
                        html += '<font color="black">未认证</font>';
                    }
                    else
					{
                        html += '<font color="red">申请中</font>';
					}
                    html += '</div>';
                    html += '</td>';

                    // 推广信息
                    html += '<td>';
                    html += '<div >';
                    if(data["data"][i]["parent"])
                    {
                        html += '<label style="float:none;width:100%" onclick=view_Member('+ data["data"][i]["parent"]["uid"] +')>' + data["data"][i]["parent"]["real_name"] + '<br>'+data["data"][i]["parent"]["user_tel"]+ '<br>'+data["data"][i]["parent"]["current_login_ip"] + '</label>';

                    }
                    else
                    {
                        html += '<label style="float:none;width:100%">无</label>';
                    }
                    html += '</div>';
                    html += '</td>';

					html += '<td align="left"> 姓名：' + data["data"][i]["real_name"]+'<br>身份证号：' + data["data"][i]["id_number"] +'<br><a href="'+ data["data"][i]["id_z"]+'" target="_blank"><img style="height: 200px" src="'+ data["data"][i]["id_z"]+'"></a><br><a href="'+ data["data"][i]["id_f"]+'" target="_blank"><img style="height: 200px" src="'+ data["data"][i]["id_f"]+'"></a></td>';
					html += '<td>' +'注册 : '+ timeStampTurnTime(data["data"][i]["reg_time"]) +'<br>'+'登录 : '+ timeStampTurnTime(data["data"][i]["current_login_time"])+'</td>';
					html += data["data"][i]["user_status"] == 0 ? '<td style="color:red;">锁定</td>' : '<td style="color:green;">正常</td>';
					html += '<td>';
                    html += '<a onclick="pass_verify('+ data["data"][i]["uid"]+',2)">通过认证</a>';
                    html += '<br><br><a onclick="pass_verify('+ data["data"][i]["uid"]+',0)">拒绝通过</a>';
					html += '</td>'
					html += '</tr>';
					$(".table-class tbody").append(html);
				}
			} else {
				var html = '<tr align="center"><td colspan="9">暂无符合条件的数据记录</td></tr>';
			}
			$(".table-class tbody").html(html);
			initPageData(data["page_count"],data['data'].length,data['total_count']);
			$("#pageNumber").html(pagenumShow(jumpNumber,$("#page_count").val(),{$pageshow}));
		}
	});
}

//搜索
function searchData(){
    LoadingInfo(1);
}

// 实名认证记录
function pass_verify(uid,verify_status){
    if(verify_status==2)
	{
		var text = "确定要通过该会员的实名认证吗";
	}
	else if(verify_status==3)
	{
		var text = "确定要修复该会员的实名认证吗";
	}
    else
	{
        var text = "确定要拒绝该会员的实名认证吗";
	}
    $( "#dialog" ).dialog({
        buttons: {
            "确定": function() {
                $.ajax({
                    type : "post",
                    url : "{:__URL('ADMIN_MAIN/Member/verifyUserInfo')}",
                    data : {
                        "uid": uid,
                        'verify_status': verify_status
                    },
                    dataType : "json",
                    success : function(data) {
                        showTip("操作成功！",'success');
                        LoadingInfo(1);
                    }
                });
                $(this).dialog('close');
            },
            "取消,#e57373": function() {
                $(this).dialog('close');
            },
        },
        contentText:text,
    });
}

//查看会员
function view_Member(uid){

    layer_index = layer.open({
        type: 2,
        title: '查看会员资料',
        shadeClose: true,
        shade: 0.8,
        area: ['90%', '90%'],
        content: __URL('ADMIN_MAIN/CoinMember/MemberInfoDetail?uid='+ uid)
    });

}
</script>
{/block}